﻿using System;
using System.Data;
using Model;
using DBUtility;

namespace DAL
{
     /// <summary>
     /// 数据访问层GA_JYJG_BAXXBA_DAL
     /// </summary>
     public class GA_JYJG_BAXXBA_DAL
     {
         public GA_JYJG_BAXXBA_DAL()
         {
         }


         /// <summary>
         /// 得到最大ID
         /// </summary>
         public int GetMax_ID(string p_strWhere)
         {
             int intResult = 0;
             string strSql = "select max(ID) as m from GA_JYJG_BAXXBA";

             if(p_strWhere.Trim().Length > 0)
             {
                 strSql += " where " + p_strWhere;
             }

             DataTable dtTemp = new DataTable();
             DbHelper.GetTable(strSql, ref dtTemp);

             if(dtTemp.Rows.Count>0)
             {
                 if(dtTemp.Rows[0]["m"].ToString().Length>0)
                 {
                     intResult = dtTemp.Rows[0]["m"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["m"]);
                 }
             }

             dtTemp.Dispose();

             return intResult + 1;

          }

          /// <summary>
          /// 得到最大ID
          /// </summary>
          public int GetMax_ID()
          {
              return GetMax_ID("");
          }


          /// <summary>
          /// 判断数据是否存在
          /// </summary>
          public bool Exists(int intID)
          {
               bool bolResult = false;


               string strSql = "";
               strSql += "select count(1) as c from GA_JYJG_BAXXBA";
               strSql += " where ";
               strSql += " ID='"+ intID +"'";

               DataTable dtTemp = new DataTable();
               DbHelper.GetTable(strSql, ref dtTemp);

               if (dtTemp.Rows.Count > 0)
               {
                   bolResult = Convert.ToInt32(dtTemp.Rows[0]["c"]) > 0;
               }

               dtTemp.Dispose();

               return bolResult;

          }

          /// <summary>
          /// 获取数据总记录数
          /// </summary>
          public int GetRecordCount(string p_strWhere)
          {
              int intResult=0;

              string strSql = "";
              strSql += "select count(1) as c from GA_JYJG_BAXXBA";
              if(p_strWhere.Trim().Length > 0)
              {
                 strSql += " where " + p_strWhere;
              }

              DataTable dtTemp = new DataTable();
              DbHelper.GetTable(strSql, ref dtTemp);

              if(dtTemp.Rows.Count>0)
              {
                  intResult=Convert.ToInt32(dtTemp.Rows[0]["c"]);
              }

              dtTemp.Dispose();

              return intResult;
          }

          /// <summary>
          /// 获取数据总记录数
          /// </summary>
          public int GetRecordCount()
          {
              return GetRecordCount("");
          }

          /// <summary>
          /// 获取数据分页总数
           /// </summary>
          public int GetPageCount(string p_strWhere, int p_intPageSize)
          {
              int intResult=0;

              if(p_intPageSize > 0)
              {
                  int intRecordCount = GetRecordCount(p_strWhere);
                  intResult = Convert.ToInt32(Math.Truncate(Convert.ToDecimal(intRecordCount) / Convert.ToDecimal(p_intPageSize)));
                  if (intRecordCount > (intResult * p_intPageSize))
                  {
                       intResult++;
                  }
              }

              if(intResult == 0)
              {
                   intResult++;
              }
              return intResult;
           }

          /// <summary>
          /// 获取数据分页总数
          /// </summary>
          public int GetPageCount(int p_intPageSize)
          {
              return GetPageCount("", p_intPageSize);
          }

          /// <summary>
          /// 添加一条数据 SQL
          /// </summary>
          public string InsertSQL(GA_JYJG_BAXXBA model)
          {
              string strFieldSQL = "";
              string strValueSQL = "";

              if(model.Changed("jczbh") == true && model.jczbh != null)
              {
                   strFieldSQL += ",jczbh";
                   strValueSQL += ",'" + model.jczbh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("jczmc") == true && model.jczmc != null)
              {
                   strFieldSQL += ",jczmc";
                   strValueSQL += ",'" + model.jczmc.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("sflw") == true && model.sflw != null)
              {
                   strFieldSQL += ",sflw";
                   strValueSQL += ",'" + model.sflw.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rdsbh") == true && model.rdsbh != null)
              {
                   strFieldSQL += ",rdsbh";
                   strValueSQL += ",'" + model.rdsbh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rdyxqs") == true && model.rdyxqs != null)
              {
                   strFieldSQL += ",rdyxqs";
                   strValueSQL += ",'" + model.rdyxqs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rdyxqz") == true && model.rdyxqz != null)
              {
                   strFieldSQL += ",rdyxqz";
                   strValueSQL += ",'" + model.rdyxqz.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shejirjcnl") == true && model.shejirjcnl != null)
              {
                   strFieldSQL += ",shejirjcnl";
                   strValueSQL += ",'" + model.shejirjcnl.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shijirjcnl") == true && model.shijirjcnl != null)
              {
                   strFieldSQL += ",shijirjcnl";
                   strValueSQL += ",'" + model.shijirjcnl.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("jcryzs") == true && model.jcryzs != null)
              {
                   strFieldSQL += ",jcryzs";
                   strValueSQL += ",'" + model.jcryzs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("wjgwrs") == true && model.wjgwrs != null)
              {
                   strFieldSQL += ",wjgwrs";
                   strValueSQL += ",'" + model.wjgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("lrgwrs") == true && model.lrgwrs != null)
              {
                   strFieldSQL += ",lrgwrs";
                   strValueSQL += ",'" + model.lrgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("ycyrs") == true && model.ycyrs != null)
              {
                   strFieldSQL += ",ycyrs";
                   strValueSQL += ",'" + model.ycyrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("dpgwrs") == true && model.dpgwrs != null)
              {
                   strFieldSQL += ",dpgwrs";
                   strValueSQL += ",'" + model.dpgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("zjgwrs") == true && model.zjgwrs != null)
              {
                   strFieldSQL += ",zjgwrs";
                   strValueSQL += ",'" + model.zjgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("qtgwrs") == true && model.qtgwrs != null)
              {
                   strFieldSQL += ",qtgwrs";
                   strValueSQL += ",'" + model.qtgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("tgszjbmkhrs") == true && model.tgszjbmkhrs != null)
              {
                   strFieldSQL += ",tgszjbmkhrs";
                   strValueSQL += ",'" + model.tgszjbmkhrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("wtgszjbmkhrs") == true && model.wtgszjbmkhrs != null)
              {
                   strFieldSQL += ",wtgszjbmkhrs";
                   strValueSQL += ",'" + model.wtgszjbmkhrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("fzjg") == true && model.fzjg != null)
              {
                   strFieldSQL += ",fzjg";
                   strValueSQL += ",'" + model.fzjg.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("glbm") == true && model.glbm != null)
              {
                   strFieldSQL += ",glbm";
                   strValueSQL += ",'" + model.glbm.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("gxrq") == true && model.gxrq != null)
              {
                   strFieldSQL += ",gxrq";
                   strValueSQL += ",'" + model.gxrq.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("bz") == true && model.bz != null)
              {
                   strFieldSQL += ",bz";
                   strValueSQL += ",'" + model.bz.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shejirjcmtsl") == true && model.shejirjcmtsl != null)
              {
                   strFieldSQL += ",shejirjcmtsl";
                   strValueSQL += ",'" + model.shejirjcmtsl.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shijirjcmtsl") == true && model.shijirjcmtsl != null)
              {
                   strFieldSQL += ",shijirjcmtsl";
                   strValueSQL += ",'" + model.shijirjcmtsl.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shbj") == true && model.shbj != null)
              {
                   strFieldSQL += ",shbj";
                   strValueSQL += ",'" + model.shbj.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("syglbm") == true && model.syglbm != null)
              {
                   strFieldSQL += ",syglbm";
                   strValueSQL += ",'" + model.syglbm.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shyj") == true && model.shyj != null)
              {
                   strFieldSQL += ",shyj";
                   strValueSQL += ",'" + model.shyj.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("zt") == true && model.zt != null)
              {
                   strFieldSQL += ",zt";
                   strValueSQL += ",'" + model.zt.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("ztyy") == true && model.ztyy != null)
              {
                   strFieldSQL += ",ztyy";
                   strValueSQL += ",'" + model.ztyy.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("dwdz") == true && model.dwdz != null)
              {
                   strFieldSQL += ",dwdz";
                   strValueSQL += ",'" + model.dwdz.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("yzbm") == true && model.yzbm != null)
              {
                   strFieldSQL += ",yzbm";
                   strValueSQL += ",'" + model.yzbm.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("xkjyfw") == true && model.xkjyfw != null)
              {
                   strFieldSQL += ",xkjyfw";
                   strValueSQL += ",'" + model.xkjyfw.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rdsffdw") == true && model.rdsffdw != null)
              {
                   strFieldSQL += ",rdsffdw";
                   strValueSQL += ",'" + model.rdsffdw.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("frdb") == true && model.frdb != null)
              {
                   strFieldSQL += ",frdb";
                   strValueSQL += ",'" + model.frdb.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("frdbsfzh") == true && model.frdbsfzh != null)
              {
                   strFieldSQL += ",frdbsfzh";
                   strValueSQL += ",'" + model.frdbsfzh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("frdblxdh") == true && model.frdblxdh != null)
              {
                   strFieldSQL += ",frdblxdh";
                   strValueSQL += ",'" + model.frdblxdh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("fzr") == true && model.fzr != null)
              {
                   strFieldSQL += ",fzr";
                   strValueSQL += ",'" + model.fzr.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("fzrsfzh") == true && model.fzrsfzh != null)
              {
                   strFieldSQL += ",fzrsfzh";
                   strValueSQL += ",'" + model.fzrsfzh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("fzrlxdh") == true && model.fzrlxdh != null)
              {
                   strFieldSQL += ",fzrlxdh";
                   strValueSQL += ",'" + model.fzrlxdh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rclxr") == true && model.rclxr != null)
              {
                   strFieldSQL += ",rclxr";
                   strValueSQL += ",'" + model.rclxr.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rclxrsfzh") == true && model.rclxrsfzh != null)
              {
                   strFieldSQL += ",rclxrsfzh";
                   strValueSQL += ",'" + model.rclxrsfzh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rclxrlxdh") == true && model.rclxrlxdh != null)
              {
                   strFieldSQL += ",rclxrlxdh";
                   strValueSQL += ",'" + model.rclxrlxdh.ToString().Replace("'","''") + "'";
              }

              string strSql = "";
              strSql += "insert into GA_JYJG_BAXXBA";
              strSql += "(";
              strSql += strFieldSQL.Substring(1);
              strSql += ")";
              strSql += " values";
              strSql += "(";
              strSql += strValueSQL.Substring(1);
              strSql += ")";

              return strSql;
          }

          /// <summary>
          /// 添加一条数据
          /// </summary>
          public bool Insert(GA_JYJG_BAXXBA model)
          {
              return DbHelper.ExecuteSql(InsertSQL(model));
          }

          /// <summary>
          /// 修改一条数据 SQL
          /// </summary>
          public string UpdateSQL(GA_JYJG_BAXXBA model,int intID)
          {
              string strUpdateSQL = "";

              if(model.Changed("jczbh") == true && model.jczbh != null)
              {
                  strUpdateSQL += ",jczbh='" + model.jczbh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("jczmc") == true && model.jczmc != null)
              {
                  strUpdateSQL += ",jczmc='" + model.jczmc.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("sflw") == true && model.sflw != null)
              {
                  strUpdateSQL += ",sflw='" + model.sflw.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rdsbh") == true && model.rdsbh != null)
              {
                  strUpdateSQL += ",rdsbh='" + model.rdsbh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rdyxqs") == true && model.rdyxqs != null)
              {
                  strUpdateSQL += ",rdyxqs='" + model.rdyxqs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rdyxqz") == true && model.rdyxqz != null)
              {
                  strUpdateSQL += ",rdyxqz='" + model.rdyxqz.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shejirjcnl") == true && model.shejirjcnl != null)
              {
                  strUpdateSQL += ",shejirjcnl='" + model.shejirjcnl.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shijirjcnl") == true && model.shijirjcnl != null)
              {
                  strUpdateSQL += ",shijirjcnl='" + model.shijirjcnl.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("jcryzs") == true && model.jcryzs != null)
              {
                  strUpdateSQL += ",jcryzs='" + model.jcryzs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("wjgwrs") == true && model.wjgwrs != null)
              {
                  strUpdateSQL += ",wjgwrs='" + model.wjgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("lrgwrs") == true && model.lrgwrs != null)
              {
                  strUpdateSQL += ",lrgwrs='" + model.lrgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("ycyrs") == true && model.ycyrs != null)
              {
                  strUpdateSQL += ",ycyrs='" + model.ycyrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("dpgwrs") == true && model.dpgwrs != null)
              {
                  strUpdateSQL += ",dpgwrs='" + model.dpgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("zjgwrs") == true && model.zjgwrs != null)
              {
                  strUpdateSQL += ",zjgwrs='" + model.zjgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("qtgwrs") == true && model.qtgwrs != null)
              {
                  strUpdateSQL += ",qtgwrs='" + model.qtgwrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("tgszjbmkhrs") == true && model.tgszjbmkhrs != null)
              {
                  strUpdateSQL += ",tgszjbmkhrs='" + model.tgszjbmkhrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("wtgszjbmkhrs") == true && model.wtgszjbmkhrs != null)
              {
                  strUpdateSQL += ",wtgszjbmkhrs='" + model.wtgszjbmkhrs.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("fzjg") == true && model.fzjg != null)
              {
                  strUpdateSQL += ",fzjg='" + model.fzjg.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("glbm") == true && model.glbm != null)
              {
                  strUpdateSQL += ",glbm='" + model.glbm.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("gxrq") == true && model.gxrq != null)
              {
                  strUpdateSQL += ",gxrq='" + model.gxrq.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("bz") == true && model.bz != null)
              {
                  strUpdateSQL += ",bz='" + model.bz.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shejirjcmtsl") == true && model.shejirjcmtsl != null)
              {
                  strUpdateSQL += ",shejirjcmtsl='" + model.shejirjcmtsl.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shijirjcmtsl") == true && model.shijirjcmtsl != null)
              {
                  strUpdateSQL += ",shijirjcmtsl='" + model.shijirjcmtsl.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shbj") == true && model.shbj != null)
              {
                  strUpdateSQL += ",shbj='" + model.shbj.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("syglbm") == true && model.syglbm != null)
              {
                  strUpdateSQL += ",syglbm='" + model.syglbm.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("shyj") == true && model.shyj != null)
              {
                  strUpdateSQL += ",shyj='" + model.shyj.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("zt") == true && model.zt != null)
              {
                  strUpdateSQL += ",zt='" + model.zt.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("ztyy") == true && model.ztyy != null)
              {
                  strUpdateSQL += ",ztyy='" + model.ztyy.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("dwdz") == true && model.dwdz != null)
              {
                  strUpdateSQL += ",dwdz='" + model.dwdz.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("yzbm") == true && model.yzbm != null)
              {
                  strUpdateSQL += ",yzbm='" + model.yzbm.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("xkjyfw") == true && model.xkjyfw != null)
              {
                  strUpdateSQL += ",xkjyfw='" + model.xkjyfw.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rdsffdw") == true && model.rdsffdw != null)
              {
                  strUpdateSQL += ",rdsffdw='" + model.rdsffdw.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("frdb") == true && model.frdb != null)
              {
                  strUpdateSQL += ",frdb='" + model.frdb.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("frdbsfzh") == true && model.frdbsfzh != null)
              {
                  strUpdateSQL += ",frdbsfzh='" + model.frdbsfzh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("frdblxdh") == true && model.frdblxdh != null)
              {
                  strUpdateSQL += ",frdblxdh='" + model.frdblxdh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("fzr") == true && model.fzr != null)
              {
                  strUpdateSQL += ",fzr='" + model.fzr.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("fzrsfzh") == true && model.fzrsfzh != null)
              {
                  strUpdateSQL += ",fzrsfzh='" + model.fzrsfzh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("fzrlxdh") == true && model.fzrlxdh != null)
              {
                  strUpdateSQL += ",fzrlxdh='" + model.fzrlxdh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rclxr") == true && model.rclxr != null)
              {
                  strUpdateSQL += ",rclxr='" + model.rclxr.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rclxrsfzh") == true && model.rclxrsfzh != null)
              {
                  strUpdateSQL += ",rclxrsfzh='" + model.rclxrsfzh.ToString().Replace("'","''") + "'";
              }

              if(model.Changed("rclxrlxdh") == true && model.rclxrlxdh != null)
              {
                  strUpdateSQL += ",rclxrlxdh='" + model.rclxrlxdh.ToString().Replace("'","''") + "'";
              }

               string strSql = "";
               strSql += "update GA_JYJG_BAXXBA set ";
               strSql += strUpdateSQL.Substring(1);
               strSql += " where ";
               strSql += " ID="+ intID +"";

               return strSql;
          }

          /// <summary>
          /// 修改一条数据
          /// </summary>
          public bool Update(GA_JYJG_BAXXBA model, int intID)
          {
              return DbHelper.ExecuteSql(UpdateSQL(model, intID));
          }

          /// <summary>
          /// 修改一个集合 SQL
          /// </summary>
           public string UpdateRangeSQL(GA_JYJG_BAXXBA model, string p_strWhere)
          {
               string strUpdateSQL = "";

               if(model.Changed("jczbh") == true && model.jczbh != null)
               {
                  strUpdateSQL += ",jczbh='" + model.jczbh.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("jczmc") == true && model.jczmc != null)
               {
                  strUpdateSQL += ",jczmc='" + model.jczmc.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("sflw") == true && model.sflw != null)
               {
                  strUpdateSQL += ",sflw='" + model.sflw.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("rdsbh") == true && model.rdsbh != null)
               {
                  strUpdateSQL += ",rdsbh='" + model.rdsbh.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("rdyxqs") == true && model.rdyxqs != null)
               {
                  strUpdateSQL += ",rdyxqs='" + model.rdyxqs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("rdyxqz") == true && model.rdyxqz != null)
               {
                  strUpdateSQL += ",rdyxqz='" + model.rdyxqz.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("shejirjcnl") == true && model.shejirjcnl != null)
               {
                  strUpdateSQL += ",shejirjcnl='" + model.shejirjcnl.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("shijirjcnl") == true && model.shijirjcnl != null)
               {
                  strUpdateSQL += ",shijirjcnl='" + model.shijirjcnl.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("jcryzs") == true && model.jcryzs != null)
               {
                  strUpdateSQL += ",jcryzs='" + model.jcryzs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("wjgwrs") == true && model.wjgwrs != null)
               {
                  strUpdateSQL += ",wjgwrs='" + model.wjgwrs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("lrgwrs") == true && model.lrgwrs != null)
               {
                  strUpdateSQL += ",lrgwrs='" + model.lrgwrs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("ycyrs") == true && model.ycyrs != null)
               {
                  strUpdateSQL += ",ycyrs='" + model.ycyrs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("dpgwrs") == true && model.dpgwrs != null)
               {
                  strUpdateSQL += ",dpgwrs='" + model.dpgwrs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("zjgwrs") == true && model.zjgwrs != null)
               {
                  strUpdateSQL += ",zjgwrs='" + model.zjgwrs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("qtgwrs") == true && model.qtgwrs != null)
               {
                  strUpdateSQL += ",qtgwrs='" + model.qtgwrs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("tgszjbmkhrs") == true && model.tgszjbmkhrs != null)
               {
                  strUpdateSQL += ",tgszjbmkhrs='" + model.tgszjbmkhrs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("wtgszjbmkhrs") == true && model.wtgszjbmkhrs != null)
               {
                  strUpdateSQL += ",wtgszjbmkhrs='" + model.wtgszjbmkhrs.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("fzjg") == true && model.fzjg != null)
               {
                  strUpdateSQL += ",fzjg='" + model.fzjg.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("glbm") == true && model.glbm != null)
               {
                  strUpdateSQL += ",glbm='" + model.glbm.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("gxrq") == true && model.gxrq != null)
               {
                  strUpdateSQL += ",gxrq='" + model.gxrq.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("bz") == true && model.bz != null)
               {
                  strUpdateSQL += ",bz='" + model.bz.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("shejirjcmtsl") == true && model.shejirjcmtsl != null)
               {
                  strUpdateSQL += ",shejirjcmtsl='" + model.shejirjcmtsl.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("shijirjcmtsl") == true && model.shijirjcmtsl != null)
               {
                  strUpdateSQL += ",shijirjcmtsl='" + model.shijirjcmtsl.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("shbj") == true && model.shbj != null)
               {
                  strUpdateSQL += ",shbj='" + model.shbj.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("syglbm") == true && model.syglbm != null)
               {
                  strUpdateSQL += ",syglbm='" + model.syglbm.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("shyj") == true && model.shyj != null)
               {
                  strUpdateSQL += ",shyj='" + model.shyj.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("zt") == true && model.zt != null)
               {
                  strUpdateSQL += ",zt='" + model.zt.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("ztyy") == true && model.ztyy != null)
               {
                  strUpdateSQL += ",ztyy='" + model.ztyy.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("dwdz") == true && model.dwdz != null)
               {
                  strUpdateSQL += ",dwdz='" + model.dwdz.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("yzbm") == true && model.yzbm != null)
               {
                  strUpdateSQL += ",yzbm='" + model.yzbm.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("xkjyfw") == true && model.xkjyfw != null)
               {
                  strUpdateSQL += ",xkjyfw='" + model.xkjyfw.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("rdsffdw") == true && model.rdsffdw != null)
               {
                  strUpdateSQL += ",rdsffdw='" + model.rdsffdw.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("frdb") == true && model.frdb != null)
               {
                  strUpdateSQL += ",frdb='" + model.frdb.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("frdbsfzh") == true && model.frdbsfzh != null)
               {
                  strUpdateSQL += ",frdbsfzh='" + model.frdbsfzh.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("frdblxdh") == true && model.frdblxdh != null)
               {
                  strUpdateSQL += ",frdblxdh='" + model.frdblxdh.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("fzr") == true && model.fzr != null)
               {
                  strUpdateSQL += ",fzr='" + model.fzr.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("fzrsfzh") == true && model.fzrsfzh != null)
               {
                  strUpdateSQL += ",fzrsfzh='" + model.fzrsfzh.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("fzrlxdh") == true && model.fzrlxdh != null)
               {
                  strUpdateSQL += ",fzrlxdh='" + model.fzrlxdh.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("rclxr") == true && model.rclxr != null)
               {
                  strUpdateSQL += ",rclxr='" + model.rclxr.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("rclxrsfzh") == true && model.rclxrsfzh != null)
               {
                  strUpdateSQL += ",rclxrsfzh='" + model.rclxrsfzh.ToString().Replace("'","''") + "'";
               }

               if(model.Changed("rclxrlxdh") == true && model.rclxrlxdh != null)
               {
                  strUpdateSQL += ",rclxrlxdh='" + model.rclxrlxdh.ToString().Replace("'","''") + "'";
               }

              string strSql = "";
              strSql += "update GA_JYJG_BAXXBA set ";
              strSql += strUpdateSQL.Substring(1);
              strSql += " where " + p_strWhere;

              return strSql;
          }

          /// <summary>
          /// 修改一个集合
          /// </summary>
          public bool UpdateRange(GA_JYJG_BAXXBA model, string p_strWhere)
          {
              return DbHelper.ExecuteSql(UpdateRangeSQL(model, p_strWhere));
          }

          /// <summary>
          /// 修改全部数据 SQL
          /// </summary>
          public string UpdateAllSQL(GA_JYJG_BAXXBA model)
          {
              string strUpdateSQL = "";

                  strUpdateSQL += ",jczbh='" + model.jczbh.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",jczmc='" + model.jczmc.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",sflw='" + model.sflw.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",rdsbh='" + model.rdsbh.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",rdyxqs='" + model.rdyxqs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",rdyxqz='" + model.rdyxqz.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",shejirjcnl='" + model.shejirjcnl.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",shijirjcnl='" + model.shijirjcnl.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",jcryzs='" + model.jcryzs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",wjgwrs='" + model.wjgwrs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",lrgwrs='" + model.lrgwrs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",ycyrs='" + model.ycyrs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",dpgwrs='" + model.dpgwrs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",zjgwrs='" + model.zjgwrs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",qtgwrs='" + model.qtgwrs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",tgszjbmkhrs='" + model.tgszjbmkhrs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",wtgszjbmkhrs='" + model.wtgszjbmkhrs.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",fzjg='" + model.fzjg.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",glbm='" + model.glbm.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",gxrq='" + model.gxrq.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",bz='" + model.bz.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",shejirjcmtsl='" + model.shejirjcmtsl.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",shijirjcmtsl='" + model.shijirjcmtsl.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",shbj='" + model.shbj.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",syglbm='" + model.syglbm.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",shyj='" + model.shyj.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",zt='" + model.zt.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",ztyy='" + model.ztyy.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",dwdz='" + model.dwdz.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",yzbm='" + model.yzbm.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",xkjyfw='" + model.xkjyfw.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",rdsffdw='" + model.rdsffdw.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",frdb='" + model.frdb.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",frdbsfzh='" + model.frdbsfzh.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",frdblxdh='" + model.frdblxdh.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",fzr='" + model.fzr.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",fzrsfzh='" + model.fzrsfzh.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",fzrlxdh='" + model.fzrlxdh.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",rclxr='" + model.rclxr.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",rclxrsfzh='" + model.rclxrsfzh.ToString().Replace("'","''") + "'";
                  strUpdateSQL += ",rclxrlxdh='" + model.rclxrlxdh.ToString().Replace("'","''") + "'";


               string strSql = "";
               strSql += "update GA_JYJG_BAXXBA set ";
               strSql += strUpdateSQL.Substring(1);

               return strSql;

          }

          /// <summary>
          /// 修改全部数据
          /// </summary>
          public bool UpdateAll(GA_JYJG_BAXXBA model)
          {
              return DbHelper.ExecuteSql(UpdateAllSQL(model));
          }

          /// <summary>
          /// 删除一条数据 SQL
          /// </summary>
          public string DeleteSQL(int intID)
          {
              string strSql = "";
              strSql += "delete from GA_JYJG_BAXXBA";
              strSql += " where ";
               strSql += " ID="+ intID +"";

              return strSql;

          }

          /// <summary>
          /// 删除一条数据
          /// </summary>
          public bool Delete(int intID)
          {
              return DbHelper.ExecuteSql(DeleteSQL(intID));
          }

          /// <summary>
          /// 删除一个集合 SQL
          /// </summary>
          public string DeleteRangeSQL(string p_strWhere)
          {
              string strSql = "";
              strSql += "delete from GA_JYJG_BAXXBA";
              strSql += " where " + p_strWhere;

              return strSql;
           }

          /// <summary>
          /// 删除一个集合
          /// </summary>
          public bool DeleteRange(string p_strWhere)
          {
              return DbHelper.ExecuteSql(DeleteRangeSQL(p_strWhere));
          }

          /// <summary>
          /// 删除全部 SQL
          /// </summary>
          public string DeleteAllSQL()
          {
              string strSql = "";
              strSql += "delete from GA_JYJG_BAXXBA";

              return strSql;
           }

         /// <summary>
         /// 删除全部
         /// </summary>
         public bool DeleteAll()
         {
             return DbHelper.ExecuteSql(DeleteAllSQL());
         }

          /// <summary>
         /// 得到一个对象实体
         /// </summary>
         public GA_JYJG_BAXXBA GetModel(int intID)
         {
             string strSql = "";
             strSql += "select * from GA_JYJG_BAXXBA";
             strSql += " where ";
               strSql += " ID="+ intID +"";

             DataTable dtTemp = new DataTable();
             DbHelper.GetTable(strSql, ref dtTemp);

             GA_JYJG_BAXXBA model = new GA_JYJG_BAXXBA();

             if(dtTemp.Rows.Count>0)
             {
                 model = new GA_JYJG_BAXXBA();

                 model.ID = dtTemp.Rows[0]["ID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[0]["ID"]);
                 model.jczbh = dtTemp.Rows[0]["jczbh"] == DBNull.Value ? "" : dtTemp.Rows[0]["jczbh"].ToString();
                 model.jczmc = dtTemp.Rows[0]["jczmc"] == DBNull.Value ? "" : dtTemp.Rows[0]["jczmc"].ToString();
                 model.sflw = dtTemp.Rows[0]["sflw"] == DBNull.Value ? "" : dtTemp.Rows[0]["sflw"].ToString();
                 model.rdsbh = dtTemp.Rows[0]["rdsbh"] == DBNull.Value ? "" : dtTemp.Rows[0]["rdsbh"].ToString();
                 model.rdyxqs = dtTemp.Rows[0]["rdyxqs"] == DBNull.Value ? "" : dtTemp.Rows[0]["rdyxqs"].ToString();
                 model.rdyxqz = dtTemp.Rows[0]["rdyxqz"] == DBNull.Value ? "" : dtTemp.Rows[0]["rdyxqz"].ToString();
                 model.shejirjcnl = dtTemp.Rows[0]["shejirjcnl"] == DBNull.Value ? "" : dtTemp.Rows[0]["shejirjcnl"].ToString();
                 model.shijirjcnl = dtTemp.Rows[0]["shijirjcnl"] == DBNull.Value ? "" : dtTemp.Rows[0]["shijirjcnl"].ToString();
                 model.jcryzs = dtTemp.Rows[0]["jcryzs"] == DBNull.Value ? "" : dtTemp.Rows[0]["jcryzs"].ToString();
                 model.wjgwrs = dtTemp.Rows[0]["wjgwrs"] == DBNull.Value ? "" : dtTemp.Rows[0]["wjgwrs"].ToString();
                 model.lrgwrs = dtTemp.Rows[0]["lrgwrs"] == DBNull.Value ? "" : dtTemp.Rows[0]["lrgwrs"].ToString();
                 model.ycyrs = dtTemp.Rows[0]["ycyrs"] == DBNull.Value ? "" : dtTemp.Rows[0]["ycyrs"].ToString();
                 model.dpgwrs = dtTemp.Rows[0]["dpgwrs"] == DBNull.Value ? "" : dtTemp.Rows[0]["dpgwrs"].ToString();
                 model.zjgwrs = dtTemp.Rows[0]["zjgwrs"] == DBNull.Value ? "" : dtTemp.Rows[0]["zjgwrs"].ToString();
                 model.qtgwrs = dtTemp.Rows[0]["qtgwrs"] == DBNull.Value ? "" : dtTemp.Rows[0]["qtgwrs"].ToString();
                 model.tgszjbmkhrs = dtTemp.Rows[0]["tgszjbmkhrs"] == DBNull.Value ? "" : dtTemp.Rows[0]["tgszjbmkhrs"].ToString();
                 model.wtgszjbmkhrs = dtTemp.Rows[0]["wtgszjbmkhrs"] == DBNull.Value ? "" : dtTemp.Rows[0]["wtgszjbmkhrs"].ToString();
                 model.fzjg = dtTemp.Rows[0]["fzjg"] == DBNull.Value ? "" : dtTemp.Rows[0]["fzjg"].ToString();
                 model.glbm = dtTemp.Rows[0]["glbm"] == DBNull.Value ? "" : dtTemp.Rows[0]["glbm"].ToString();
                 model.gxrq = dtTemp.Rows[0]["gxrq"] == DBNull.Value ? "" : dtTemp.Rows[0]["gxrq"].ToString();
                 model.bz = dtTemp.Rows[0]["bz"] == DBNull.Value ? "" : dtTemp.Rows[0]["bz"].ToString();
                 model.shejirjcmtsl = dtTemp.Rows[0]["shejirjcmtsl"] == DBNull.Value ? "" : dtTemp.Rows[0]["shejirjcmtsl"].ToString();
                 model.shijirjcmtsl = dtTemp.Rows[0]["shijirjcmtsl"] == DBNull.Value ? "" : dtTemp.Rows[0]["shijirjcmtsl"].ToString();
                 model.shbj = dtTemp.Rows[0]["shbj"] == DBNull.Value ? "" : dtTemp.Rows[0]["shbj"].ToString();
                 model.syglbm = dtTemp.Rows[0]["syglbm"] == DBNull.Value ? "" : dtTemp.Rows[0]["syglbm"].ToString();
                 model.shyj = dtTemp.Rows[0]["shyj"] == DBNull.Value ? "" : dtTemp.Rows[0]["shyj"].ToString();
                 model.zt = dtTemp.Rows[0]["zt"] == DBNull.Value ? "" : dtTemp.Rows[0]["zt"].ToString();
                 model.ztyy = dtTemp.Rows[0]["ztyy"] == DBNull.Value ? "" : dtTemp.Rows[0]["ztyy"].ToString();
                 model.dwdz = dtTemp.Rows[0]["dwdz"] == DBNull.Value ? "" : dtTemp.Rows[0]["dwdz"].ToString();
                 model.yzbm = dtTemp.Rows[0]["yzbm"] == DBNull.Value ? "" : dtTemp.Rows[0]["yzbm"].ToString();
                 model.xkjyfw = dtTemp.Rows[0]["xkjyfw"] == DBNull.Value ? "" : dtTemp.Rows[0]["xkjyfw"].ToString();
                 model.rdsffdw = dtTemp.Rows[0]["rdsffdw"] == DBNull.Value ? "" : dtTemp.Rows[0]["rdsffdw"].ToString();
                 model.frdb = dtTemp.Rows[0]["frdb"] == DBNull.Value ? "" : dtTemp.Rows[0]["frdb"].ToString();
                 model.frdbsfzh = dtTemp.Rows[0]["frdbsfzh"] == DBNull.Value ? "" : dtTemp.Rows[0]["frdbsfzh"].ToString();
                 model.frdblxdh = dtTemp.Rows[0]["frdblxdh"] == DBNull.Value ? "" : dtTemp.Rows[0]["frdblxdh"].ToString();
                 model.fzr = dtTemp.Rows[0]["fzr"] == DBNull.Value ? "" : dtTemp.Rows[0]["fzr"].ToString();
                 model.fzrsfzh = dtTemp.Rows[0]["fzrsfzh"] == DBNull.Value ? "" : dtTemp.Rows[0]["fzrsfzh"].ToString();
                 model.fzrlxdh = dtTemp.Rows[0]["fzrlxdh"] == DBNull.Value ? "" : dtTemp.Rows[0]["fzrlxdh"].ToString();
                 model.rclxr = dtTemp.Rows[0]["rclxr"] == DBNull.Value ? "" : dtTemp.Rows[0]["rclxr"].ToString();
                 model.rclxrsfzh = dtTemp.Rows[0]["rclxrsfzh"] == DBNull.Value ? "" : dtTemp.Rows[0]["rclxrsfzh"].ToString();
                 model.rclxrlxdh = dtTemp.Rows[0]["rclxrlxdh"] == DBNull.Value ? "" : dtTemp.Rows[0]["rclxrlxdh"].ToString();
             }

             dtTemp.Dispose();

             return model;
         }

         /// <summary>
         /// 得到一个对象实体
         /// </summary>
         public void GetModel(ref DataTable p_dtData, int intID)
         {
             p_dtData.Clear();

             string strSql = "";
             strSql += "select * from GA_JYJG_BAXXBA";
             strSql += " where ";
               strSql += " ID="+ intID +"";

              DbHelper.GetTable(strSql, ref p_dtData);
         }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public GA_JYJG_BAXXBA[] GetModelList(string p_strWhere, string p_strOrder, int p_intPageNumber, int p_intPageSize)
      {
          int m_intPageNumber = p_intPageNumber;
          int m_intPageCount = GetPageCount(p_strWhere, p_intPageSize);

          if((m_intPageNumber < 1) || (m_intPageNumber == 0))
          {
               m_intPageNumber = 1;
          }

          if(m_intPageNumber == -1)
          {
               m_intPageNumber = m_intPageCount;
          }

          if(m_intPageNumber > m_intPageCount)
          {
               m_intPageNumber = m_intPageCount;
          }

          string strSql = "";
          strSql += "select * from GA_JYJG_BAXXBA";
          if(p_strWhere.Trim().Length > 0)
          {
               strSql += " where " + p_strWhere;
          }
          if(p_strOrder.Trim().Length > 0)
          {
               strSql += " order by " + p_strOrder;
          }

          DataTable dtTemp = new DataTable();

          if(p_intPageSize > 0)
          {
               DbHelper.GetTable(strSql, ref dtTemp, (m_intPageNumber-1)*p_intPageSize, p_intPageSize);
          }
          else
          {
               DbHelper.GetTable(strSql, ref dtTemp);
          }

          GA_JYJG_BAXXBA[] arrModel=new GA_JYJG_BAXXBA[dtTemp.Rows.Count];

          for(int N=0;N<dtTemp.Rows.Count;N++)
          {
               arrModel[N] = new GA_JYJG_BAXXBA();

                 arrModel[N].ID = dtTemp.Rows[N]["ID"] == DBNull.Value ? 0 : Convert.ToInt32(dtTemp.Rows[N]["ID"]);
                 arrModel[N].jczbh = dtTemp.Rows[N]["jczbh"] == DBNull.Value ? "" : dtTemp.Rows[N]["jczbh"].ToString();
                 arrModel[N].jczmc = dtTemp.Rows[N]["jczmc"] == DBNull.Value ? "" : dtTemp.Rows[N]["jczmc"].ToString();
                 arrModel[N].sflw = dtTemp.Rows[N]["sflw"] == DBNull.Value ? "" : dtTemp.Rows[N]["sflw"].ToString();
                 arrModel[N].rdsbh = dtTemp.Rows[N]["rdsbh"] == DBNull.Value ? "" : dtTemp.Rows[N]["rdsbh"].ToString();
                 arrModel[N].rdyxqs = dtTemp.Rows[N]["rdyxqs"] == DBNull.Value ? "" : dtTemp.Rows[N]["rdyxqs"].ToString();
                 arrModel[N].rdyxqz = dtTemp.Rows[N]["rdyxqz"] == DBNull.Value ? "" : dtTemp.Rows[N]["rdyxqz"].ToString();
                 arrModel[N].shejirjcnl = dtTemp.Rows[N]["shejirjcnl"] == DBNull.Value ? "" : dtTemp.Rows[N]["shejirjcnl"].ToString();
                 arrModel[N].shijirjcnl = dtTemp.Rows[N]["shijirjcnl"] == DBNull.Value ? "" : dtTemp.Rows[N]["shijirjcnl"].ToString();
                 arrModel[N].jcryzs = dtTemp.Rows[N]["jcryzs"] == DBNull.Value ? "" : dtTemp.Rows[N]["jcryzs"].ToString();
                 arrModel[N].wjgwrs = dtTemp.Rows[N]["wjgwrs"] == DBNull.Value ? "" : dtTemp.Rows[N]["wjgwrs"].ToString();
                 arrModel[N].lrgwrs = dtTemp.Rows[N]["lrgwrs"] == DBNull.Value ? "" : dtTemp.Rows[N]["lrgwrs"].ToString();
                 arrModel[N].ycyrs = dtTemp.Rows[N]["ycyrs"] == DBNull.Value ? "" : dtTemp.Rows[N]["ycyrs"].ToString();
                 arrModel[N].dpgwrs = dtTemp.Rows[N]["dpgwrs"] == DBNull.Value ? "" : dtTemp.Rows[N]["dpgwrs"].ToString();
                 arrModel[N].zjgwrs = dtTemp.Rows[N]["zjgwrs"] == DBNull.Value ? "" : dtTemp.Rows[N]["zjgwrs"].ToString();
                 arrModel[N].qtgwrs = dtTemp.Rows[N]["qtgwrs"] == DBNull.Value ? "" : dtTemp.Rows[N]["qtgwrs"].ToString();
                 arrModel[N].tgszjbmkhrs = dtTemp.Rows[N]["tgszjbmkhrs"] == DBNull.Value ? "" : dtTemp.Rows[N]["tgszjbmkhrs"].ToString();
                 arrModel[N].wtgszjbmkhrs = dtTemp.Rows[N]["wtgszjbmkhrs"] == DBNull.Value ? "" : dtTemp.Rows[N]["wtgszjbmkhrs"].ToString();
                 arrModel[N].fzjg = dtTemp.Rows[N]["fzjg"] == DBNull.Value ? "" : dtTemp.Rows[N]["fzjg"].ToString();
                 arrModel[N].glbm = dtTemp.Rows[N]["glbm"] == DBNull.Value ? "" : dtTemp.Rows[N]["glbm"].ToString();
                 arrModel[N].gxrq = dtTemp.Rows[N]["gxrq"] == DBNull.Value ? "" : dtTemp.Rows[N]["gxrq"].ToString();
                 arrModel[N].bz = dtTemp.Rows[N]["bz"] == DBNull.Value ? "" : dtTemp.Rows[N]["bz"].ToString();
                 arrModel[N].shejirjcmtsl = dtTemp.Rows[N]["shejirjcmtsl"] == DBNull.Value ? "" : dtTemp.Rows[N]["shejirjcmtsl"].ToString();
                 arrModel[N].shijirjcmtsl = dtTemp.Rows[N]["shijirjcmtsl"] == DBNull.Value ? "" : dtTemp.Rows[N]["shijirjcmtsl"].ToString();
                 arrModel[N].shbj = dtTemp.Rows[N]["shbj"] == DBNull.Value ? "" : dtTemp.Rows[N]["shbj"].ToString();
                 arrModel[N].syglbm = dtTemp.Rows[N]["syglbm"] == DBNull.Value ? "" : dtTemp.Rows[N]["syglbm"].ToString();
                 arrModel[N].shyj = dtTemp.Rows[N]["shyj"] == DBNull.Value ? "" : dtTemp.Rows[N]["shyj"].ToString();
                 arrModel[N].zt = dtTemp.Rows[N]["zt"] == DBNull.Value ? "" : dtTemp.Rows[N]["zt"].ToString();
                 arrModel[N].ztyy = dtTemp.Rows[N]["ztyy"] == DBNull.Value ? "" : dtTemp.Rows[N]["ztyy"].ToString();
                 arrModel[N].dwdz = dtTemp.Rows[N]["dwdz"] == DBNull.Value ? "" : dtTemp.Rows[N]["dwdz"].ToString();
                 arrModel[N].yzbm = dtTemp.Rows[N]["yzbm"] == DBNull.Value ? "" : dtTemp.Rows[N]["yzbm"].ToString();
                 arrModel[N].xkjyfw = dtTemp.Rows[N]["xkjyfw"] == DBNull.Value ? "" : dtTemp.Rows[N]["xkjyfw"].ToString();
                 arrModel[N].rdsffdw = dtTemp.Rows[N]["rdsffdw"] == DBNull.Value ? "" : dtTemp.Rows[N]["rdsffdw"].ToString();
                 arrModel[N].frdb = dtTemp.Rows[N]["frdb"] == DBNull.Value ? "" : dtTemp.Rows[N]["frdb"].ToString();
                 arrModel[N].frdbsfzh = dtTemp.Rows[N]["frdbsfzh"] == DBNull.Value ? "" : dtTemp.Rows[N]["frdbsfzh"].ToString();
                 arrModel[N].frdblxdh = dtTemp.Rows[N]["frdblxdh"] == DBNull.Value ? "" : dtTemp.Rows[N]["frdblxdh"].ToString();
                 arrModel[N].fzr = dtTemp.Rows[N]["fzr"] == DBNull.Value ? "" : dtTemp.Rows[N]["fzr"].ToString();
                 arrModel[N].fzrsfzh = dtTemp.Rows[N]["fzrsfzh"] == DBNull.Value ? "" : dtTemp.Rows[N]["fzrsfzh"].ToString();
                 arrModel[N].fzrlxdh = dtTemp.Rows[N]["fzrlxdh"] == DBNull.Value ? "" : dtTemp.Rows[N]["fzrlxdh"].ToString();
                 arrModel[N].rclxr = dtTemp.Rows[N]["rclxr"] == DBNull.Value ? "" : dtTemp.Rows[N]["rclxr"].ToString();
                 arrModel[N].rclxrsfzh = dtTemp.Rows[N]["rclxrsfzh"] == DBNull.Value ? "" : dtTemp.Rows[N]["rclxrsfzh"].ToString();
                 arrModel[N].rclxrlxdh = dtTemp.Rows[N]["rclxrlxdh"] == DBNull.Value ? "" : dtTemp.Rows[N]["rclxrlxdh"].ToString();
          }

          dtTemp.Dispose();

          return arrModel;
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public GA_JYJG_BAXXBA[] GetModelList(string p_strWhere)
      {
          return GetModelList(p_strWhere, "", -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public GA_JYJG_BAXXBA[] GetModelList(string p_strWhere, string p_strOrder)
      {
          return GetModelList(p_strWhere, p_strOrder, -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public GA_JYJG_BAXXBA[] GetModelList(int p_intPageNumber, int p_intPageSize)
      {
          return GetModelList("", "", p_intPageNumber, p_intPageSize);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public GA_JYJG_BAXXBA[] GetModelList(string p_strWhere, int p_intPageNumber, int p_intPageSize)
      {
          return GetModelList(p_strWhere, "", p_intPageNumber, p_intPageSize);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public GA_JYJG_BAXXBA[] GetModelList()
      {
          return GetModelList("", "", -1, -1);
      }

      /// <summary>
      /// 得到对象集合
      /// </summary>
      public void GetModelList(ref DataTable p_dtData, string p_strWhere, string p_strOrder, int p_intPageNumber, int p_intPageSize)
      {
          p_dtData.Clear();

          int m_intPageNumber = p_intPageNumber;
          int m_intPageCount = GetPageCount(p_strWhere, p_intPageSize);

          if((m_intPageNumber < 1) || (m_intPageNumber == 0))
          {
              m_intPageNumber = 1;
          }

          if(m_intPageNumber == -1)
          {
              m_intPageNumber = m_intPageCount;
          }

          if(m_intPageNumber > m_intPageCount)
          {
              m_intPageNumber = m_intPageCount;
          }

          string strSql = "";
          strSql += "select * from GA_JYJG_BAXXBA";
          if(p_strWhere.Trim().Length > 0)
          {
              strSql += " where " + p_strWhere;
          }
          if(p_strOrder.Trim().Length > 0)
          {
              strSql += " order by " + p_strOrder;
          }

          if(p_intPageSize > 0)
          {
              DbHelper.GetTable(strSql, ref p_dtData, (m_intPageNumber-1)*p_intPageSize, p_intPageSize);
          }
          else
          {
              DbHelper.GetTable(strSql, ref p_dtData);
          }
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere)
       {
           GetModelList(ref p_dtData, p_strWhere, "", -1, -1);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere, string p_strOrder)
       {
           GetModelList(ref p_dtData, p_strWhere, p_strOrder, -1, -1);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, int p_intPageNumber, int p_intPageSize)
       {
           GetModelList(ref p_dtData, "", "", p_intPageNumber, p_intPageSize);
       }

       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData, string p_strWhere, int p_intPageNumber, int p_intPageSize)
       {
           GetModelList(ref p_dtData, p_strWhere, "", p_intPageNumber, p_intPageSize);
       }
       /// <summary>
       /// 得到对象集合
       /// </summary>
       public void GetModelList(ref DataTable p_dtData)
       {
           GetModelList(ref p_dtData, "", "", -1, -1);
       }
   }
}
